package com.springcloudemo.ms.dubbo;

import org.apache.dubbo.common.extension.ExtensionDirector;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.rpc.model.ApplicationModel;

/**
 * @author Yangdw
 * @date 2025-08-24
 * @description:
 */
public class DubboMain {

    public static void main(String[] args) {
//        ExtensionLoader<DubboSPI> extensionLoader = ExtensionLoader.getExtensionLoader(DubboSPI.class);

// ✅ 正确方式：从 ApplicationModel 获取
        ExtensionDirector director = ApplicationModel.defaultModel().getExtensionDirector();

// 然后使用它获取 ExtensionLoader
        ExtensionLoader<DubboSPI> loader = director.getExtensionLoader(DubboSPI.class);
        DubboSPI log4j = loader.getExtension("log4j");
        DubboSPI redis = loader.getExtension("redis");
        System.out.println(log4j.spi());
        System.out.println(redis.spi());
    }

}
